package com.chain.qs.modules.biz.dp.handler;

import com.chain.qs.modules.biz.entity.EquipmentItemRecordLYEnvironmentDev;
import com.chain.qs.modules.biz.service.EquipmentItemRecordLYEnvironmentDevService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.Map;

/**
 * 温湿度传感器
 */
@Component("CAEnvironmentDev")
public class LYEnvironmentDev extends AbstractDPHandler {
    @Resource
    private EquipmentItemRecordLYEnvironmentDevService equipmentItemRecordLYEnvironmentDevService;

    public void saveData(Map<String, Object> params) {
        EquipmentItemRecordLYEnvironmentDev entity = new EquipmentItemRecordLYEnvironmentDev();
        entity.setOfficeCode(officeCode);
        entity.setSgroupId(sgroupId);
        entity.setGitemId(deviceId);
        entity.setFogWn(params.get("fog_wn") == null ? "" : params.get("fog_wn").toString());
        entity.setWaterWn(params.get("water_wn") == null ? "" : params.get("water_wn").toString());
        entity.setTimeStamp(new Timestamp(System.currentTimeMillis()));
        equipmentItemRecordLYEnvironmentDevService.save(entity);
    }
}
